package com.winit.requirement.model;

import javax.persistence.Column;
import javax.persistence.Embeddable;
import java.io.Serializable;

public class ReqFeatureId implements Serializable{
    @Column(name = "req_id")
    private String reqId;
    @Column(name = "feature_id")
    private String featureId;

    public String getReqId() {
        return reqId;
    }

    public void setReqId(String reqId) {
        this.reqId = reqId;
    }

    public String getFeatureId() {
        return featureId;
    }

    public void setFeatureId(String featureId) {
        this.featureId = featureId;
    }

    @Override
    public int hashCode() {
        final int PRIME = 31;
        int result = 1;
        result = PRIME * result + ((reqId == null) ? 0 : reqId.hashCode());
        result = PRIME * result + ((featureId == null) ? 0 : featureId.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj){
        if(this == obj){
            return true;
        }
        if(obj == null){
            return false;
        }
        if(getClass() != obj.getClass()){
            return false;
        }
        ReqFeatureId reqFeatureId = (ReqFeatureId)obj;
        boolean equal = true;
        if (reqId == null){
            equal = reqId == reqFeatureId.getReqId();
        }else {
            equal = this.reqId.equals(reqFeatureId.getReqId());
        }
        if (!equal){
            return equal;
        }

        if (featureId == null){
            equal = this.featureId == reqFeatureId.getFeatureId();
        }else {
            equal = this.featureId.equals(reqFeatureId.getFeatureId());
        }

        return equal;
    }
}
